package com.itheima.controller;

import com.itheima.pojo.StudentPojo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@RestController
@RequestMapping("/Students")
public class LoginController {
    @RequestMapping("/login")
    public String login(String username,String password){
        System.out.println("登录成功");
        return "用户名为"+username+"密码为"+password;
    }

    @GetMapping("student")
    public List<StudentPojo> selectStudent(){
        List<StudentPojo> list = new ArrayList<>();
        StudentPojo name1 = new StudentPojo("汤云鹤", 18);
        StudentPojo name2 = new StudentPojo("李苗", 18);

        Collections.addAll(list,name1,name2);
        return list;
    }
}
